﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using EntModApp.EntServices.Properties;

namespace EntModApp.EntServices.Validation
{
  [Serializable]
  public class MultiValidationException : Exception
  {
    public MultiValidationException(IEnumerable<ValidationResult> _Errors_, string message, Exception innerException)
      : base(message, innerException)
    {
      if (_Errors_ == null) throw new ArgumentNullException("_Errors_");

      Errors = _Errors_.ToArray();
    }

    public MultiValidationException(IEnumerable<ValidationResult> _Errors_, string message)
      : base(message)
    {
      if (_Errors_ == null) throw new ArgumentNullException("_Errors_");

      Errors = _Errors_.ToArray();
    }

    public MultiValidationException(IEnumerable<ValidationResult> _Errors_)
      : base(Resources.MultiValidationExceptionMessage)
    {
      if (_Errors_ == null) throw new ArgumentNullException("_Errors_");

      Errors = _Errors_.ToArray();
    }

    public IEnumerable<ValidationResult> Errors { get; private set; }
  }
}
